<!-- gapline.vue -->
<template>
  <div class="container" :style="{ '--skew': skew + 'deg' }">
    <div class="type-box" v-for="(item, index) in dataList" :key="index">
      <div class="type-name">{{ item.areaName }}</div>
      <div class="subbar">
        <div class="progressBorder">
          <div class="type-progress">
            <div class="progress" :style="{ width: item.areaProportion * 100 + '%' }"></div>
          </div>
        </div>

        <div class="type-num">{{ item.areaProportion * 100 }}%</div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'GapLine',
  props: ['skew', 'dataList']
}
</script>
<style scoped lang="scss">
.container {
  width: 100%;
  height: 100%;
}
.type-box {
  display: inline-block;
  flex-direction: column;
  width: 45%;
  // height: 7vh;
  height: 90px;
  &:nth-child(2n) {
    margin-left: 5%;
  }
}

.type-name {
  font-size: 14px;
  color: #ffffff;
  line-height: 30px;
}

.type-progress {
  position: relative;
  flex: 1;
  height: 8px;
  transform: skew(var(--skew));
}
.type-progress::before,
.type-progress::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}
/* 浅色背景层 */
.type-progress::before {
  z-index: -1;
}
/* 分割线层 */
.type-progress::after {
  z-index: 1;
  background: linear-gradient(to right, transparent 50%, #2c3340 50%) 0 0/4% 100% repeat-x;
}
/* 进度层 */
.progress {
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, #38516b, #5baceb);
}
.type-num {
  margin-left: 10px;
  font-size: 20px;
  font-family: Avenir, Avenir-Roman;
  color: #ffffff;
}

.subbar {
  display: flex;
  align-items: center;
}

.progressBorder {
  flex: 1;
  height: 18px;
  padding: 4px;
  padding-left: 0;
  border: 1px solid;
  -o-border-image: linear-gradient(135deg, #369fff, #2e3958 10%, #2e3958 90%, #369fff) 1;
  border-image: linear-gradient(135deg, #369fff, #2e3958 10%, #2e3958 90%, #369fff) 1;
  border-radius: 1px;
}
</style>
